<template>
  <div class="advert">
    <NavbarIndex />
    <div class="container">
          <article>
            <div v-html="advert.content"></div>
          </article>
    </div>
    <FooterIndex />
  </div>
</template>

<script>
// @ is an alias to /src
import FooterIndex from "@/components/FooterIndex.vue";
import NavbarIndex from "@/components/NavbarIndex.vue";
import { formatDate } from '../util/date.js';

export default {
  name: "advert",
  components: {
    NavbarIndex,
    FooterIndex,
  },
  data () {
    return {
      domain: process.env.VUE_APP_baseURL,
      advert: ''
    };
  },
  created () {
    this.getData();
  },
  watch: {
    '$route' (to, form) {
      this.getData();
    }
  },
  methods: {
    //获取详情页内容
    getData () {
      let that = this;
      that.axios
        .post("/content/advert/show", {
          id: that.$route.params.id
        })
        .then(function (ret) {
          that.advert = ret.data
        })
        .catch(function (error) {
          console.log(error);
        });
    },
     },
  
};
</script>
<style>
.advert img {
  max-width: 100%;
}
</style>
